cmake_minimum_required(VERSION 3.10)
project(fake_log_iov)

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)

include_directories(include)
link_directories(./)

# Build static libraries
add_library(c_module STATIC c_module.c)
add_library(fake_inno_log_cpp STATIC fake_inno_log_cpp.cpp)

# Build C++ example
add_executable(cpp_example cpp_example.cpp)
target_link_libraries(cpp_example c_module fake_inno_log_cpp)

# Set output directories
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

# Clean target
add_custom_target(clean_all
    COMMAND ${CMAKE_BUILD_TOOL} clean
    COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/build
    COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin
    COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/lib
)
